import {Component, Input, OnInit} from "@angular/core";
import {PermissionDetail} from "@shared/models/Permission";
import {FileInfo} from "@shared/models/FileInfo";

@Component({
  selector: 'bby-permission-card-body',
  template:
    `
    <div *ngIf="file&&file.permission&&detail">
      全局开关：
      <nz-switch [(ngModel)]="detail.open"></nz-switch>
      <div style="margin: 10px 0px">
        <label [nzDisabled]="!detail.open||file.isFile" nz-checkbox [(ngModel)]="detail.create">创建</label>
        <label [disabled]="!detail.open" nz-checkbox [(ngModel)]="detail.copy">复制</label>
        <label [disabled]="!detail.open" nz-checkbox [(ngModel)]="detail.move">移动</label>
        <label [disabled]="!detail.open" nz-checkbox [(ngModel)]="detail.delete">删除</label>
        <!--          <br />-->
        <label [disabled]="!detail.open" nz-checkbox [(ngModel)]="detail.download">下载</label>
        <label [disabled]="!detail.open" nz-checkbox [(ngModel)]="detail.view">可见</label>
        <label [disabled]="!detail.open" nz-checkbox [(ngModel)]="detail.edit">修改</label>
        <br />
      </div>
      <label [disabled]="!detail.open" nz-checkbox [(ngModel)]="detail.needPw">使用密码</label>
      <input [disabled]="!detail.open"  *ngIf="detail.needPw" nz-input placeholder="密码" [(ngModel)]="file.permission.pw" />
    </div>
    `
})
export class PermissionCaredBody{
  @Input() detail: PermissionDetail | undefined;
  @Input() file: FileInfo | undefined;

}
